package com.bee2c.pub.quartz.bean;

public class JsonResult implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

	public static final String SUCCESS = "success";

	public static final String FAIL = "fail";
	
	private String status;
	
	private String statusCode;

	private String message;
	
	private Object data;
	
	public static JsonResult success(){
		return success(null);
	}
	
	public static JsonResult success(Object data){
		return success(null, data);
	}
	
	public static JsonResult success(String message, Object data){
		return success(null, message, data);
	}
	
	public static JsonResult success(String statusCode, String message, Object data){
		JsonResult jsonObj = new JsonResult();
		jsonObj.setStatus(SUCCESS);
		jsonObj.setStatusCode(statusCode);
		jsonObj.setMessage(message);
		jsonObj.setData(data);
		return jsonObj;
	}
	
	public boolean isSuccess(){
		return SUCCESS.equals(this.getStatus());
	}
	
	public static JsonResult fail(){
		return fail(null);
	}
	
	public static JsonResult fail(Object data){
		return fail(null, data);
	}
	
	public static JsonResult fail(String message, Object data){
		return fail(null, message, data);
	}
	
	public static JsonResult fail(String statusCode, String message, Object data){
		JsonResult jsonObj = new JsonResult();
		jsonObj.setStatus(FAIL);
		jsonObj.setStatusCode(statusCode);
		jsonObj.setMessage(message);
		jsonObj.setData(data);
		return jsonObj;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
}
